using I2.Loc;
using UnityEngine;

public class MarketGunInfoPanel : MarketProductInfoPanel
{
	public UILabel lethalyCount;

	public UILabel fireRateCount;

	public UILabel mobilityCount;

	public UILabel ammoLabel;

	public UILabel ammoCount;

	public UILabel lethalyCountADD;

	public UILabel fireRateCountADD;

	public UILabel mobilityCountADD;

	public UILabel ammoCountADD;

	public GameObject powerInfo;

	public GameObject ammoInfo;

	public UISprite weaponTypeSprite;

	public UILabel weaponTypeLabel;

	public UISprite damageTypeSprite;

	public UILabel damageTypeLabel;

	public UISprite rareTypeSprite;

	public UILabel rareTypeLabel;

	public override void SetInfo(Product product, bool setUpgrades, bool needComparison = true)
	{
		currentProduct = product;
		base.SetInfo(product, setUpgrades);
		ProductWeapon productWeapon = (ProductWeapon)product;
		ProductWeapon productWeapon2 = ((!needComparison) ? product : MarketControllerUI.instance.selectedProduct) as ProductWeapon;
		float num = 0f;
		num = ((productWeapon.shotType != ShotType.Spread) ? productWeapon.damage : (productWeapon.damage * (float)productWeapon.bulletsPerShot));
		float num2 = 0f;
		num2 = ((productWeapon2.shotType != ShotType.Spread) ? productWeapon2.damage : (productWeapon2.damage * (float)productWeapon2.bulletsPerShot));
		lethalyCount.text = num.ToString();
		fireRateCount.text = productWeapon.fireRate.ToString("F0");
		mobilityCount.text = productWeapon.mobility.ToString();
		ammoCount.text = productWeapon.ammo.ToString();
		ammoInfo.SetActive(productWeapon.ammo != 0f);
		if (productWeapon2 == productWeapon)
		{
			lethalyCount.text = num.ToString();
			fireRateCount.text = productWeapon.fireRate.ToString("F0");
			mobilityCount.text = productWeapon.mobility.ToString();
			ammoCount.text = productWeapon.ammo.ToString();
			if ((bool)lethalyCountADD)
			{
				lethalyCountADD.text = string.Empty;
			}
			if ((bool)fireRateCountADD)
			{
				fireRateCountADD.text = string.Empty;
			}
			if ((bool)mobilityCountADD)
			{
				mobilityCountADD.text = string.Empty;
			}
			if ((bool)ammoCountADD)
			{
				ammoCountADD.text = string.Empty;
			}
		}
		else
		{
			lethalyCount.text = num2.ToString();
			fireRateCount.text = productWeapon2.fireRate.ToString("F0");
			mobilityCount.text = productWeapon2.mobility.ToString();
			ammoCount.text = productWeapon2.ammo.ToString();
			if ((bool)lethalyCountADD)
			{
				lethalyCountADD.text = CompareParametrs(num, num2, "F0");
			}
			if ((bool)fireRateCountADD)
			{
				fireRateCountADD.text = CompareParametrs(productWeapon.fireRate, productWeapon2.fireRate, "F0");
			}
			if ((bool)mobilityCountADD)
			{
				mobilityCountADD.text = CompareParametrs(productWeapon.mobility, productWeapon2.mobility, "F0");
			}
			if ((bool)ammoCountADD)
			{
				ammoCountADD.text = CompareParametrs(productWeapon.ammo, productWeapon2.ammo, "F0");
			}
		}
		if ((bool)weaponTypeSprite)
		{
			weaponTypeSprite.spriteName = "ShotType_" + productWeapon.shotType;
		}
		if ((bool)weaponTypeLabel)
		{
			weaponTypeLabel.text = ScriptLocalization.Get("Market/ShotType_" + productWeapon.shotType);
		}
		if ((bool)damageTypeSprite)
		{
			damageTypeSprite.spriteName = "DamageType_" + productWeapon.damageType;
		}
		if ((bool)damageTypeLabel)
		{
			damageTypeLabel.text = ScriptLocalization.Get("Market/DamageType_" + productWeapon.damageType);
		}
		if ((bool)rareTypeSprite)
		{
			rareTypeSprite.spriteName = "RareType_" + productWeapon.rare;
		}
		if ((bool)rareTypeLabel)
		{
			rareTypeLabel.text = ScriptLocalization.Get("Market/RareType_" + productWeapon.rare);
		}
		SetTitleLocalization();
		SetDescriptionLocalization();
		if (setUpgrades)
		{
			SetUpgrades();
		}
		else
		{
			SelectUpgradeButton();
		}
	}
}
